import React, { useState, useEffect } from 'react'

const LikeButton: React.FC = () => {
	const [like, setLike] = useState(0)

	useEffect(() => {
		console.log('document title effect is running')

		document.title = `点击了 ${like} 次`
	})

	return (
		<>
			<button>
				<span>{like}</span>
				<span onClick={() => setLike(like + 1)}>👍</span>
			</button>
		</>
	)
}

export default LikeButton
